 {include file="indexTop" /}
<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md8">
            <div class="fly-panel">
                <div class="fly-panel-title fly-filter">
                    <a>置顶</a>
                    <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">去签到</a>
                </div>

                <!-- 置顶 -->
                <ul class="fly-list">
                    <?php foreach ($top as $row): ?>
                    <?php $row['ctime']=ftime($row['ctime']); ?>
                    <li>
                        <a href="" class="fly-avatar">
                            <img src="__root__{:$row['avatar']}" alt="{:$row['username']}"> </a>
                        <h2>
                            <a class="layui-badge">{:$row['cname']}</a>
                            <a href="{:url('index/Read/index',['pid'=>$row['pid']])}">{:$row['title']}</a>
                        </h2>
                        <div class="fly-list-info">
                            <a href="/u/168" link>
                                <cite>{:$row['username']}</cite>
                                <?php if ($row['is_approve']): ?>
                                <i class="iconfont icon-renzheng" title="认证信息：root"></i>
                                <?php endif ?>
                            </a>
                            <span>{:$row['ctime']} </span>
                            <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻">
                                <i class="iconfont icon-kiss"></i> 20</span>
                            <!-- 已结/未结 -->
                            <?php if ($row['status']=='1'): ?>
                            <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
                            <?php endif ?>


                            <span class="fly-list-nums">
                                <i class="iconfont icon-pinglun1" title="回答"></i> {:$row['answer_num']} </span>
                        </div>
                        <div class="fly-list-badge"> </div>
                    </li>

                    <?php endforeach; ?>

                </ul>
            </div>
            <!-- 置顶结束 -->
            <div class="fly-panel" style="margin-bottom: 0;">
                <div class="fly-panel-title fly-filter">
                    <a href="/column/all/" class="layui-this">综合</a>
                    <span class="fly-mid"></span>
                    <a href="/column/all/unsolved/">未结</a>
                    <span class="fly-mid"></span>
                    <a href="/column/all/solved/">已结</a>
                    <span class="fly-mid"></span>
                    <a href="/column/all/wonderful/">精华</a>
                </div>

                <!-- 帖子 -->
                <ul class="fly-list">
                    <?php foreach ($data as $key => $data): ?>
                    <?php $data['ctime']=ftime($data['ctime']); ?>
                    <li>
                        <a href="" class="fly-avatar">
                            <img src="__root__{:$data['avatar']}" alt="{:$data['username']}"> </a>
                        <h2>
                            <a class="layui-badge">{:$data['cname']}</a>
                            <a href="{:url('index/Read/index',['pid'=>$data['pid']])}">{:$data['title']}</a>
                        </h2>
                        <div class="fly-list-info">
                            <a href="/u/168" link>
                                <cite>{:$data['username']}</cite>
                                <?php if ($data['is_approve']): ?>
                                <i class="iconfont icon-renzheng" title="认证信息：root"></i>
                                <?php endif ?>
                            </a>
                            <span>{:$data['ctime']} </span>
                            <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻">
                                <i class="iconfont icon-kiss"></i> 20</span>
                            <!-- 已结/未结 -->
                            <?php if ($data['status']=='1'): ?>
                            <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
                            <?php endif ?>
                            <span class="fly-list-nums">
                                <i class="iconfont icon-pinglun1" title="回答"></i> {:$data['answer_num']} </span>
                        </div>
                        <div class="fly-list-badge"> </div>
                    </li>
                    <?php endforeach ?>
                </ul>


                <div style="text-align: center">
                    <div class="laypage-main">
                        <a href="/column/all/page/2/" class="laypage-next">更多求解</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-md4">
            <!-- 温馨通道 -->
            <div class="fly-panel">
                <h3 class="fly-panel-title">温馨通道</h3>
                <ul class="fly-panel-main fly-list-static">
                    <li>
                        <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云) 仓库，欢迎Star</a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/5366/" target="_blank"> layui 常见问题的处理和实用干货集锦 </a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/13435/" target="_blank"> 关于Fly社区飞吻的消耗与增加 </a>
                    </li>
                    <li>
                        <a name="signin"></a>
                        <a href="http://fly.layui.com/jie/19804/" target="_blank"> 《layui从鱼到渔》系列教程 </a>
                    </li>
                    <li>
                        <a href="http://www.layui.com/template/fly/" target="_blank">下载“Fly社区”页面模板：Fly Template</a>
                    </li>
                </ul>
            </div>
            <!-- 签到 -->
            <div class="fly-panel fly-signin">
                <div class="fly-panel-title"> 签到
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜
                        <span class="layui-badge-dot"></span>
                    </a>
                    <span class="fly-signin-days">
                        <?php if ($sign): ?> 已连续签到
                        <cite>{$sign['cn']}</cite>天
                        <?php endif ?>
                    </span>
                </div>
                <!-- 今日签到 -->
                <div class="fly-panel-main fly-signin-main">

                    <?php if ($sign): ?>
                    <button class="layui-btn layui-btn-disabled">今日已签到</button>
                    <span>获得了
                        <cite>{:$sign['cn']*5}</cite>飞吻</span>
                    <?php else: ?>
                    <button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>
                    <span>可以获得
                        <cite>{:$sign['cn']*5}</cite>飞吻</span>
                    <?php endif ?>
                </div>
            </div>
            <!-- 赞助商 -->
            <!-- <div class="fly-panel">
                <div class="fly-panel-title"> 钻级赞助商
                    <span class="fly-mid"></span>
                    <a href="/jie/15697/" class="fly-link fly-joinad    ">我要加入</a>
                </div>
                <div class="fly-panel-main" style="padding: 13px 15px;">
                    <a href="/jie/15697/" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: #393D49;">虚席以待</a>
                </div>
            </div> -->
            <!-- 回帖周榜 -->
            <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
                <h3 class="fly-panel-title">回贴周榜</h3>
                <dl>
                    <?php foreach ($replyRank as $row): ?>
                    <dd>
                        <a href="/u/6779304">
                            <img src="__root__{$row['avatar']}">
                            <cite>{$row['username']}</cite>
                            <i>{$row['cn']}次回答</i>
                        </a>
                    </dd>
                    <?php endforeach ?>
                    

                </dl>
            </div>
            <!-- 本周热议 -->
            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">本周热议</dt>
                <?php foreach ($hotPost as $row): ?>
                <dd>
                    <a href="{:url('index/read/index',['pid'=>$row['pid']])}">{$row['title']}</a>
                    <span>
                        <i class="iconfont icon-pinglun1"></i> {$row['answer_num']}</span>
                </dd>
                <?php endforeach ?>

            </dl>
            
            <!-- 公众号 -->
            <div class="fly-panel" style="padding: 20px 0; text-align: center;">
                <img src="//cdn.layui.com/upload/2017_8/168_1501894831075_19619.jpg" style="max-width: 100%;" alt="layui">
                <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p>
            </div>
            <!-- 友情链接 -->
            <div class="fly-panel fly-link">
                <h3 class="fly-panel-title">友情链接</h3>
                <dl class="fly-panel-main">
                    <dd>
                        <a href="https://juejin.im?from=layui" target="_blank">掘金开发者社区</a>
                    </dd>
                    <dd>
                        <a href="http://layim.layui.com/" target="_blank">WebIM</a>
                    </dd>
                    <dd>
                        <a href="http://layer.layui.com/" target="_blank">layer</a>
                    </dd>
                    <dd>
                        <a href="http://www.layui.com/laydate/" target="_blank">layDate</a>
                    </dd>
                    <dd>
                        <a href="http://www.bejson.com/" target="_blank">JSON在线工具</a>
                    </dd>
                    <dd>
                        <a href="http://www.smeoa.com/" target="_blank">小微OA</a>
                    </dd>
                    <dd>
                        <a href="http://www.fineui.com/" target="_blank">FineUI开源控件</a>
                    </dd>
                    <dd>
                        <a href="http://www.javashop.cn/" target="_blank">Javashop</a>
                    </dd>
                    <dd>
                        <a href="https://www.hellojava.com/" target="_blank">Java菜鸟社区</a>
                    </dd>
                    <dd>
                        <a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a>
                    </dd>
                </dl>
            </div>
        </div>
    </div>
</div>




<script type="text/javascript">

    layui.use(['jquery', 'layer'], function () {
        $ = layui.jquery;
        layer = layui.layer;

        $('#LAY_signin').click(function () {
            $.ajax({
                url: '{:url('index/Sign/sign')}',
                type: 'GET',
                dataType: 'json',
            })
                .done(function (res) {
                    if (res.error == 1) {
                        layer.msg(res.info, { icon: 5 }, function () {
                        });
                    } else {
                        layer.msg(res.info, { icon: 6 }, function () {
                            location.href = res.url;
                        });
                    }
                })
                .fail(function () {
                    console.log("error");
                });


        })
        $('#LAY_signinTop').click(function () {

            layer.open({
                type: 2,
                title: '签到活跃榜 - TOP 20',
                shadeClose: true,
                shade: 0.8,
                area: ['310px', '60%'],
                content: '{:url('index/sign/signlist')}' //iframe的url
        });



        })



    })





</script>